package com.ds.cli;


import com.ds.cli.command.ConfigCommand;
import com.ds.cli.command.GenerateCommand;
import com.ds.cli.command.ListCommand;
import picocli.CommandLine;
import picocli.CommandLine.Command;

@Command(name="ds",mixinStandardHelpOptions = true)
public class CommandExecutor implements Runnable {  //负责执行子命令

    private final CommandLine commandLine;

    {
        commandLine =new CommandLine(this)
                .addSubcommand(new ConfigCommand())
                .addSubcommand(new GenerateCommand())
                .addSubcommand(new ListCommand());
    }

    @Override
    public void run(){
        //不输入命令时给出提示
        System.out.println("请输入具体命令，或输入--help查看命令提示");
    }

    /**
     * 执行命令
     * @param args
     * @return
     */
    public Integer doExecute(String[] args){
        return commandLine.execute(args);

    }

}
